<?php


namespace Aspic\Form\Decorator;

use Aspic as A;
use Aspic\Form as Form;

abstract class AbstractDecorator implements DecoratorInterface {
	
	/**
	 * Check element renderability
	 * @return True if $el is renderable or false if not
	 */
	abstract protected function isRenderable(Form\Element\AbstractElement $el);
	
	protected function checkRenderable(Form\Element\AbstractElement $el) {
		if (!$this->isRenderable($el)) {
			throw new Form\Decorator\CannotRenderException($this, $el);
		}
		
		return true;
	}
	
}